#include <iostream>
#include <memory.h>
using namespace std;
int main(){
	int n=5,a[n]={7,8,9,2,5},r[n],rn=-1;
	bool f[n];
	memset(f,0,sizeof(f));
	for(;rn<n-1;){
		int min_id=-1;
		long long min=1000000000000l;
		for(int i=0;i<n;i++){
            if(min>a[i] && f[i]==false){
	    	    min=a[i];
			    min_id=i;
		    }
        }
        f[min_id]=true;
	        r[rn+1]=min;
	        rn++;    
	}
	for(int i=0;i<=rn;i++){
		cout<<r[i]<<" ";
	}
	return 0;
}
